import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {useUserStore} from "@/store/modules/user";
//列表数据
export const columns: BasicColumn[] = [
  /*{
    title: '数据终端id',
    align:"center",
    dataIndex: 'terminalId'
  },*/
   {
    title: '数据终端编号',
    align:"center",
    dataIndex: 'terminalNo'
   },
   {
    title: '数据终端名称',
    align:"center",
    dataIndex: 'terminalName'
   },
   {
    title: '温度',
    align:"center",
    dataIndex: 'temperature'
   },
   {
    title: '湿度',
    align:"center",
    dataIndex: 'humidity'
   },
  {
    title: '电压',
    align:"center",
    dataIndex: 'voltage'
  },
  {
    title: '时间',
    align:"center",
    dataIndex: 'createTime'
  },
   /*{
    title: '元素据',
    align:"center",
    dataIndex: 'metaData'
   },*/
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "创建日期",
    field: "createTime",
    component: 'RangePicker',
    componentProps: {
      valueType: 'Date',
      showTime:true
    },
    //colProps: {span: 6},
  },
	{
      label: "数据终端",
      field: 'terminalId',
      component: 'JSearchSelect',
      componentProps:{
        dict:"terminal,name,id,sys_org_code like '"+ useUserStore().getUserInfo.orgCode+"%'",
        adjustY: true,
    },
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '数据终端编号',
    field: 'terminalNo',
    component: 'Input',
    dynamicDisabled:true
  },
  /*{
    label: '数据终端id',
    field: 'terminalId',
    component: 'Input',
    dynamicDisabled:true
  },*/
  {
    label: '数据终端名称',
    field: 'terminalName',
    component: 'Input',
    dynamicDisabled:true
  },
  {
    label: '温度',
    field: 'temperature',
    component: 'Input',
    dynamicDisabled:true
  },
  {
    label: '湿度',
    field: 'humidity',
    component: 'Input',
    dynamicDisabled:true
  },
  /*{
    label: '元素据',
    field: 'metaData',
    component: 'Input',
    dynamicDisabled:true
  },*/
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  terminalNo: {title: '数据终端编号',order: 0,view: 'text', type: 'string',},
  terminalId: {title: '数据终端id',order: 1,view: 'text', type: 'string',},
  terminalName: {title: '数据终端名称',order: 2,view: 'text', type: 'string',},
  temperature: {title: '温度',order: 3,view: 'text', type: 'string',},
  humidity: {title: '湿度',order: 4,view: 'text', type: 'string',},
  metaData: {title: '元素据',order: 5,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一�? 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
